package it.unibz.ti2.internetPizzeria.entities;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Storing information about user
 *
 */

@Entity
@Table(name = "USERS", uniqueConstraints = {@UniqueConstraint(columnNames={"USER_LOGIN"})})
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
    name="usertype",
    discriminatorType=DiscriminatorType.STRING
)
@DiscriminatorValue("User")
public abstract class User {

	@Id
	@GeneratedValue
	@Column(name = "USER_ID")
	private long id;
	
	@Column(name = "USER_LOGIN")
	private String login;
	
	@Column(name = "USER_PASSWORDHASH")
	private int passwordHash;
	
	@Column(name = "USER_NAME")
	private String name;
	
	@Column(name = "USER_SURNAME")
	private String surname;
	
	
	
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public String getLogin() {
		return login;
	}
	public void setLogin(String login) {
		this.login = login;
	}
	public int getPasswordHash() {
		return passwordHash;
	}
	public void setPasswordHash(int passwordHash) {
		this.passwordHash = passwordHash;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getSurname() {
		return surname;
	}
	public void setSurname(String surname) {
		this.surname = surname;
	}
	
	
}
